package net.xju3_4.service.impl;
import net.xju3_4.common.utils.PageInfo;
import net.xju3_4.dao.CarDao;
import net.xju3_4.entity.Car;
import net.xju3_4.service.CarService;
import java.math.BigDecimal;
import java.util.List;

public class CarServiceImpl implements CarService {

    CarDao carDao = new CarDao();


    @Override
    public void insert(Car car) {
        carDao.insert(car);
    }

    @Override
    public Car selectOne(int id) {
        return carDao.selectOne(id);
    }

    @Override
    public void deleteById(int id) {
        carDao.deleteById(id);
    }

    @Override
    public void update(Car car) {
        carDao.update(car);
    }

//    @Override
//    public PageInfo<Car> pageList(Integer pageNum, Integer pageSize, String licensePlate, String model, Integer typeId, String brand) {
//        return carDao.pageList(licensePlate,model, typeId, brand, pageNum, pageSize);
//    }

    @Override
    public PageInfo<Car> browseCarList(Integer pageNum, Integer pageSize, String brand, Integer typeId, BigDecimal minPrice, BigDecimal maxPrice) {
        return carDao.browseCarList(pageNum, pageSize, brand, typeId, minPrice, maxPrice);
    }

    @Override
    public List<String> getUnavailableDates(int carId) {
        return carDao.getUnavailableDates(carId);
    }

    @Override
    public List<Object> getCarTypes() {
        return carDao.getCarTypes();
    }

    @Override
    public PageInfo<Car> pageList(Integer pageNum, Integer pageSize, String licensePlate, String model, Integer typeId, String brand,Integer merchantId) {
        return carDao.pageList(licensePlate,model, typeId, brand, pageNum, pageSize,merchantId);
    }
}